package com.wanbangee.marksystem.service.imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wanbangee.marksystem.dao.UStudentDao;
import com.wanbangee.marksystem.entities.UStudent;
import com.wanbangee.marksystem.service.UStudentService;


@Service
public class UStudentServiceImp implements UStudentService {

	@Autowired
	private UStudentDao uStudentDao;
	
	@Override
	public boolean addStudent(UStudent student) {
		
		if (uStudentDao.selectCountByStuNoAndSchId(student.getStuNo(), student.getSchId())>=1) {
			
			return false;
		}
		
		return this.uStudentDao.addStudent(student);
	}

	@Override
	public boolean updateStudent(UStudent student) {
		// TODO Auto-generated method stub
		return this.uStudentDao.updateStudent(student);
	}

	@Override
	public UStudent selectStudentByStuId(Integer stuId) {
		// TODO Auto-generated method stub
		return this.uStudentDao.selectStudentByStuId(stuId);
	}

	@Override
	public List<UStudent> selectStudentBySchIdAndGradId(Integer schId, Integer graId) {
		// TODO Auto-generated method stub
		return this.uStudentDao.selectStudentBySchIdAndGradId(schId, graId);
	}

	@Override
	public List<UStudent> selectStudentBySchIdAndGradIdAndClaId(Integer schId, Integer graId, Integer claId) {
		// TODO Auto-generated method stub
		return this.uStudentDao.selectStudentBySchIdAndGradIdAndClaId(schId, graId,claId);
	}

	@Override
	public List<UStudent> selectStudentBySchId(Integer schId) {
		// TODO Auto-generated method stub
		return this.uStudentDao.selectStudentBySchId(schId);
	}

	@Override
	public Integer deleteStudent(Integer stuId) {
		// TODO Auto-generated method stub
		this.uStudentDao.deleteStudent(stuId);
		return 1001;
	}

	
}
